/**
 * Copyright &copy; 2015-2017  All rights reserved.
 * Licensed under the 深圳市闲闲科技 License, Version 1.0 (the "License");
 *
 */
package com.kehutong.admin.entity;

import java.util.List;

import org.coraframework.json.annotation.JSONField;
import org.coraframework.orm.Entity;
import org.coraframework.orm.annotation.Column;
import org.coraframework.orm.annotation.Table;

import com.kehutong.common.entity.Root;
import org.coraframework.orm.annotation.UnSave;


@Table("sys_role")
public class Role extends Entity {

	private static final long serialVersionUID = 1016417869090528542L;

	protected Role(String id) {
        super(id);
        this.data_scope = "1";
	}

	@Column(comment="公司编号")
    private String companyNo;
	
	@Column(comment="公司名称")
	private String companyName;

	@Column(comment="角色名称")
    private String name;

	@Column(comment="数据范围（1：所有数据；2：所在公司及以下数据；3：所在公司数据；4：所在部门及以下数据；5：所在部门数据；6：仅本人数据；7：按明细设置）")
    private String data_scope;

	@Column(comment = "指定部门")
	private List<String> manageDepartment;
    
	@Column(length=Short.MAX_VALUE, comment="菜单列表")
	private List<String> menus;
	
	@Column(length = 64, comment="备注")
	private String remarks;
	
	@JSONField(serialize=false)
	@Column(comment = "逻辑删除")
	private boolean deleted;
	
	@JSONField(serialize=false)
	@Column(comment = "修改者")
	private String update_by;

	@JSONField(serialize=false)
	@Column(comment = "创建者")
	private String create_by;

	@Column(length=Short.MAX_VALUE, comment="")
	private List<String> items;

	@Column(comment="客户中台-通讯录查看状态")
	private boolean newsletterState;

	@Column(comment="客户中台-首页统计查看状态")
	private boolean frontPageState;

	@Column(comment="客户中台-我的企业查看状态")
	private boolean businessState;

	@Column(comment="客户中台-设置查看状态")
	private boolean settingState;

	@UnSave
	private List<String> appNames;

	@UnSave
	private List<RoleItem> roleItems;

	@UnSave
	private List<String> employeeNo;

	@UnSave
	private List<String> employeeName;

	public String getCompanyNo() {
		return companyNo;
	}

	public void setCompanyNo(String companyNo) {
		this.companyNo = companyNo;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getData_scope() {
		return data_scope;
	}

	public void setData_scope(String data_scope) {
		this.data_scope = data_scope;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	public List<String> getMenus() {
		return menus;
	}

	public String getUpdate_by() {
		return update_by;
	}

	public void setUpdate_by(String update_by) {
		this.update_by = update_by;
	}

	public String getCreate_by() {
		return create_by;
	}

	public void setCreate_by(String create_by) {
		this.create_by = create_by;
	}

	public void setMenus(List<String> menus) {
		this.menus = menus;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}
	
	@JSONField(serialize=false)
	public boolean isAdmin() {
		return Root.isRoot(getId());
	}

	public List<String> getEmployeeNo() {
		return employeeNo;
	}

	public void setEmployeeNo(List<String> employeeNo) {
		this.employeeNo = employeeNo;
	}

	public List<String> getEmployeeName() {
		return employeeName;
	}

	public void setEmployeeName(List<String> employeeName) {
		this.employeeName = employeeName;
	}

	public List<String> getItems() {
		return items;
	}

	public void setItems(List<String> items) {
		this.items = items;
	}

	public List<RoleItem> getRoleItems() {
		return roleItems;
	}

	public void setRoleItems(List<RoleItem> roleItems) {
		this.roleItems = roleItems;
	}

	public List<String> getAppNames() {
		return appNames;
	}

	public void setAppNames(List<String> appNames) {
		this.appNames = appNames;
	}

	public List<String> getManageDepartment() {
		return manageDepartment;
	}

	public void setManageDepartment(List<String> manageDepartment) {
		this.manageDepartment = manageDepartment;
	}

	public boolean isNewsletterState() {
		return newsletterState;
	}

	public void setNewsletterState(boolean newsletterState) {
		this.newsletterState = newsletterState;
	}

	public boolean isFrontPageState() {
		return frontPageState;
	}

	public void setFrontPageState(boolean frontPageState) {
		this.frontPageState = frontPageState;
	}

	public boolean isBusinessState() {
		return businessState;
	}

	public void setBusinessState(boolean businessState) {
		this.businessState = businessState;
	}

	public boolean isSettingState() {
		return settingState;
	}

	public void setSettingState(boolean settingState) {
		this.settingState = settingState;
	}
}
